package com.hfb.mashibing.alip8.juc.c003;

/**
 * synchronized 关键字
 * 对某个对象加锁
 */
public class T1 {

    private int count = 10;

    // 等价于 synchronized(this)
    public synchronized void m() {
        count --;
        System.out.println(
                Thread.currentThread().getName() +
                " count=" + count);

    }

    public void n(){
        count ++;

    }
}
